package level4.shaders
{
	import flash.display.DisplayObject;
	import flash.display.Shader;
	import flash.display.Stage;
	import flash.events.Event;
	import flash.filters.ShaderFilter;
	import flash.net.URLLoader;
	import flash.net.URLLoaderDataFormat;
	import flash.net.URLRequest;
	
	/**
	 * 像素化shader
	 * */
	public class PixelShader extends BaseShader
	{
		private var step:Number = 50.0;
		
		private var playSpeed:Number = 2.4;
		
		public function PixelShader(do2d:DisplayObject)
		{
			super("assets/shaders/pixel.pbj",do2d);
		}
		override public function update(timeDiff:Number):void{
			if(isShaderLoadOk){
				shader.data.dimension.value = [step];
				do2d.filters = [new ShaderFilter(shader)];
				step -= playSpeed;
				if(step <= 1){
					clean();
				}
			}
		}
	}
}